package ace.module.upms.sdk.core.feign.impl;

import ace.cmp.core.model.R;
import ace.cmp.openfeign.security.oauth2.core.config.FeignInternalServerOauth2SecurityConfig;
import ace.module.upms.api.UpmsAuthorityApi;
import ace.module.upms.sdk.core.constant.SdkConstant;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import java.util.Set;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 权限对象 rpc contract.
 *
 * @author: caspar
 */
@FeignClient(
    name = "${spring.cloud.openfeign.client.upmsAuthorityFeign.name:"
        + SdkConstant.FEIGN_SERVICE_NAME + "}",
    contextId = "upmsAuthorityFeign",
    path = UpmsAuthorityFeign.PATH,
    configuration = FeignInternalServerOauth2SecurityConfig.class)
public interface UpmsAuthorityFeign extends UpmsAuthorityApi {

  String PATH =
      "${spring.cloud.openfeign.client.upmsAuthorityFeign.path:/rpc/upms/upms-authority}";

  /**
   * 获取权限应用下的账户所有权限标识
   *
   * @param upmsAppId 权限应用id
   * @param accountId 账户id
   * @return
   */
  @Operation(summary = "获取权限应用下的账户所有权限标识", description = "")
  @GetMapping(path = "/getByUpmsAppIdAndAccountId")
  R<Set<String>> getByUpmsAppIdAndAccountId(
      @Valid @NotNull @RequestParam("upmsAppId") Long upmsAppId,
      @Valid @NotNull @RequestParam("accountId") Long accountId);
}
